package com.rui.study.commons.study.support.configuration;

import com.rui.study.commons.study.model.MailWrapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

@Configuration
public class BlockingQueueConfiguration {

    @Bean(name = "blockingQueue")
    public BlockingQueue<MailWrapper> myQueue(@Value("${app.common.blocking-queue.capacity:2}")int capacity) {
        return new LinkedBlockingQueue(capacity);
    }
}
